<template>
  <ul class="panel">
    <li class="item" v-for="(item, index) in items" :key="index">
      <div class="decribe">
        {{item.decribe}}
      </div>
      <div class="num">
        {{item.num}}
      </div>
    </li>
  </ul>
</template>
<script>
import httpSer from "@/http";
export default {
  data() {
    return {
      items: [
        { decribe: "全部项目", num: 0, key: "total" },
        { decribe: "已完成", num: 0, key: "completed" },
        { decribe: "进行中", num: 0, key: "inProgress" },
        { decribe: "立项审批中", num: 0, key: "startApproval" },
        { decribe: "已延迟", num: 0, key: "delayed" },
        { decribe: "结项审批中", num: 0, key: "endApproval" },
        { decribe: "已结项", num: 0, key: "end" }
      ]
    };
  },
  created() {},
  mounted() {
    this.getProjectStatistics();
  },
  methods: {
    getProjectStatistics() {
      let url = "/project/projectStatistics";
      let data = {
        manageId: "7"
      };
      httpSer.post(url, data).then(res => {
        this.items.forEach((item, index) => {
          for (let prop in res) {
            if (item.key === prop) {
              this.$set(this.items[index], "num", res[prop]);
            }
          }
        });
      });
    }
  },
  filters: {},
  components: {}
};
</script>

<style lang="less" scope>
@import "./index.less";
</style>